package com.yl.users.mapper

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.yl.users.entity.CompanyDept
import com.yl.users.pojo.vo.CompanyDeptSelectVo
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param

@Mapper
interface CompanyDeptMapper : BaseMapper<CompanyDept> {

	/**
	 * 查询树状图
	 */
	fun selectDeptTree(companyDept: CompanyDeptSelectVo): MutableList<CompanyDept>

	/**
	 * 查询某部门下面是否存在该部门
	 * @param deptId
	 * @param subId
	 * @return
	 */
	fun selectHaveSubId(
		@Param("deptId") deptId: Long,
		@Param("subId") subId: Long,
		@Param("companyId") companyId: Long
	): Int

	/**
	 * 查询列表
	 */
	fun selectDeptList(@Param("vo")vo: CompanyDeptSelectVo): MutableList<CompanyDept>

	/**
	 * 查询列表分页
	 */
	fun selectDeptPage(
		@Param("page") page: Page<CompanyDept>,
		@Param("vo") vo: CompanyDeptSelectVo
	): Page<CompanyDept>

	/**
	 * 获取下级分院列表
	 */
	fun getSubCompanyList(deptId: Long): MutableList<CompanyDept>
}
